package com.xzy.servlet;


import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Properties;

public class Test03 {
    public static void main(String[] args) throws Exception {
        InputStream stream = Test03.class.getClassLoader().getResourceAsStream("info.properties");
        Properties p=new Properties();
        p.load(stream);

        String className = p.getProperty("className");
        String methodName = p.getProperty("methodName");

        //根据类的全类名通过CLass获取类的Class加载器
        Class cla = Class.forName(className);
        //获取类的无参构造器
        Constructor constructor = cla.getConstructor();
        Object obj = constructor.newInstance();
        Method method = cla.getMethod(methodName);
        method.invoke(obj);
    }
}
